package com.youshang520i.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

import javax.annotation.PostConstruct;

/**
 * @author youshang
 * @date 2021/02/26 16:29
 **/
@PropertySource(value = "classpath:/db.properties")
@Configuration
public class MyConfig4 {

    @Autowired
    Environment environment;

    @PostConstruct
    public void prere() {
        String property = environment.getProperty("server.port");
        System.out.println(property);
    }
}


